#include<bits/stdc++.h>

using namespace std;

int main() {
    int a[] = {1, 2, 3};
    for (int i = 0; i < 6; i++) {
        cout << a[0] << a[1] << a[2] << endl;
        next_permutation(a, a + 3); //132
    }


}
